#include "WeaponWrapper.h"

#include "Weapon.h"
#include "luawrapper.hpp"

static Weapon *Weapon_new(lua_State *L)
{
	return new Weapon();
}

static int Weapon_attack(lua_State *L)
{
	Weapon *weapon = luaW_check<Weapon>(L, 1);
	Character *character = luaW_check<Character>(L, 2);
	weapon->attack(character);
	return 0;
}

static luaL_Reg Weapon_table[] =
{
	{ NULL, NULL }
};

static luaL_Reg Weapon_metatable[] =
{
	{ "attack", Weapon_attack },
	{ NULL, NULL }
};

int luaopen_Weapon(lua_State* L)
{
	luaW_register<Weapon>(L, "Weapon", Weapon_table, Weapon_metatable, Weapon_new);
	return 1;
}
